#!/usr/bin/env python
from flask import Flask
from config import basedir
from flask.ext.login import  LoginManager
from flask.ext.openid import OpenID
import os

app = Flask(__name__)
app.config.from_object('config')
app.config.setdefault('SQLALCHEMY_TRACK_MODIFICATIONS',True)

lm = LoginManager()
lm.init_app(app)
lm.login_view = 'login'
oid = OpenID(app, os.path.join(basedir, 'tmp'))
from app import views, models

if not app.debug:
    import logging
    from logging.handlers import SMTPHandler
    credentials = None
    if Mail_USERNAME or Mail_PASSWORD:
        credentials = (Mail_USERNAME, Mail_PASSWORD)
    mail_handler = SMTPHandler(Mail_)